package cn.buk.tms.eotms.dto;

import cn.buk.tms.common.dto.CustomerDto;
import cn.buk.tms.eotms.entity.BillHotelBooking;
import cn.buk.tms.eotms.entity.BillTrainTicket;
import cn.buk.tms.eotms.entity.Customer;
import cn.buk.tms.eotms.entity.SettlementSheet;
import cn.buk.tms.eotms.report.dto.ReportTicketChangeDto;
import cn.buk.tms.eotms.report.dto.ReportTicketDto;
import cn.buk.tms.eotms.report.dto.ReportTicketRefundDto;
import org.springframework.beans.BeanUtils;

import java.util.List;

public class SettlementReportDto {

    /**
     * 结算单编号
     */
    private String settlementNo;

    /**
     * 客户名称
     */
    private String customerName;

    /**
     * 客户代码
     */
    private String customerCode;

    /**
     * 结算单名称
     */
    private String settlementTitle;

    /**
     * 结算单金额
     */
    private double amount;


    //机票
    private List<ReportTicketDto> tickets;
    //退票
    private List<ReportTicketRefundDto> refunds;
    //改签
    private List<ReportTicketChangeDto> changes;
    //服务
    private List<SettlementReportVasDto> vasOrders;
    //酒店
    private List<SettlementReportHotelDto> hotels;
    //火车票
    private List<SettlementReportTrainDto> trains;

    public static SettlementReportDto createBySettlement(SettlementSheet ss) {
        SettlementReportDto dto = new SettlementReportDto();
        BeanUtils.copyProperties(ss, dto);
        dto.setSettlementTitle(ss.getName());

        if (ss.getCustomer() != null) {
            Customer c = ss.getCustomer();
            CustomerDto customerDto = CustomerDto.create(c.getId(), c.getVipName(), c.getCustomerCode());
            dto.setCustomerName(customerDto.getName());
            dto.setCustomerCode(customerDto.getCustomerCode());
        }

        return dto;
    }


    public List<ReportTicketDto> getTickets() {
        return tickets;
    }

    public void setTickets(List<ReportTicketDto> tickets) {
        this.tickets = tickets;
    }

    public List<ReportTicketRefundDto> getRefunds() {
        return refunds;
    }

    public void setRefunds(List<ReportTicketRefundDto> refunds) {
        this.refunds = refunds;
    }

    public List<SettlementReportVasDto> getVasOrders() {
        return vasOrders;
    }

    public void setVasOrders(List<SettlementReportVasDto> vasOrders) {
        this.vasOrders = vasOrders;
    }

    public List<SettlementReportHotelDto> getHotels() {
        return hotels;
    }

    public void setHotels(List<SettlementReportHotelDto> hotels) {
        this.hotels = hotels;
    }

    public List<SettlementReportTrainDto> getTrains() {
        return trains;
    }

    public void setTrains(List<SettlementReportTrainDto> trains) {
        this.trains = trains;
    }

    public String getSettlementNo() {
        return settlementNo;
    }

    public void setSettlementNo(String settlementNo) {
        this.settlementNo = settlementNo;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public List<ReportTicketChangeDto> getChanges() {
        return changes;
    }

    public void setChanges(List<ReportTicketChangeDto> changes) {
        this.changes = changes;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public String getSettlementTitle() {
        return settlementTitle;
    }

    public void setSettlementTitle(String settlementTitle) {
        this.settlementTitle = settlementTitle;
    }

    public String getCustomerCode() {
        return customerCode;
    }

    public void setCustomerCode(String customerCode) {
        this.customerCode = customerCode;
    }
}
